26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
50 #pragma package(smart_init)
63 Graphics::TBitmap* SmallGraphicPtrVal): SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
65 for(
int x = 0; x < 4; x++)
74 else if(SpeedTagVal == 77)
76 else if(SpeedTagVal == 78)
78 else if(SpeedTagVal == 79)
80 else if(SpeedTagVal == 96)
82 else if(SpeedTagVal == 129)
84 else if(SpeedTagVal == 130)
86 else if(SpeedTagVal == 131)
88 else if(SpeedTagVal == 145)
90 else if(SpeedTagVal == 146)
97 FixedNamedLocationElement(false)
99 for(
int x = 0; x < 4; x++)
110 AnsiString(VLocInput));
123 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
133 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
145 Graphics::TBitmap *GraphicOutput = GraphicPtr;
147 if(LocationName ==
"")
192 GraphicOutput = GraphicPtr;
196 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
205 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
206 AnsiString(TrainIDOnBridgeTrackPos01) +
"," + AnsiString(TrainIDOnBridgeTrackPos23) +
",EndTrkEl,";
215 if(lower.second < higher.second)
219 else if(lower.second > higher.second)
223 else if(lower.second == higher.second)
225 if(lower.first < higher.first)
238 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
239 CheckCount(9), IsARoute(false), AutoSignals(false), ConsecSignals(false)
243 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
254 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
282 {2, 4}, {6, 2}, {8, 6}, {4, 8},
283 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
291 else if(
Link[2] == -1)
300 else if(
Link[2] == -1)
308 for(
int x = 0; x < 16; x++)
310 if((Entry == EXArray[x][0]) && (Exit == EXArray[x][1]) || (Entry == EXArray[x][1]) && (Exit == EXArray[x][0]))
440 throw Exception(
"Error in EntryExitNumber 4");
516 throw Exception(
"Error in EntryExitNumber 5");
537 if(!AutoSigsFlag && !ConsecSignalsRoute)
590 throw Exception(
"Error in EntryExitNumber 6");
604 else if(!AutoSigsFlag && ConsecSignalsRoute)
657 throw Exception(
"Error in EntryExitNumber 10");
724 throw Exception(
"Error in EntryExitNumber 11");
797 throw Exception(
"Error in EntryExitNumber 7");
822 throw Exception(
"Error in EntryExitNumber 8");
833 if((ELink > 0) && (ELink < 10) && (ELink != 5))
835 if(!AutoSigsFlag && !ConsecSignalsRoute)
837 else if(!AutoSigsFlag && ConsecSignalsRoute)
844 throw Exception(
"Error in EntryExitNumber 9");
880 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
905 AnsiString NL =
'\n';
908 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL +
909 "blocked by a train, another route or a changing level crossing; " + NL +
910 "or invalid - possibly due to a preferred direction mismatch or a missed signal in a green or blue route.";
917 int InternalLinkCheckArray[9][2] =
918 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
923 for(
int x = 0; x < 9; x++)
924 for(
int y = 0; y < 2; y++)
928 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
930 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
931 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
932 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
933 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
934 << 60 << 61 << 62 << 63 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
941 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
943 for(
int x = 0; x < 10; x++)
944 for(
int y = 0; y < 2; y++)
950 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
953 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
954 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
956 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
957 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
959 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
960 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
963 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
966 for(
int x = 0; x < 40; x++)
972 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
975 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
976 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
978 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
979 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
981 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
982 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
985 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
988 for(
int x = 0; x < 40; x++)
994 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
997 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
998 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1000 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1001 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1003 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1004 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1007 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1010 for(
int x = 0; x < 40; x++)
1036 for(
int x = 0; x < 40; x++)
1063 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1064 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1065 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1066 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1067 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1068 {0, 0, 129}, {0, -1, 145},
1071 for(
int x = 0; x < 25; x++)
1072 for(
int y = 0; y < 3; y++)
1077 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1078 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1079 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1080 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1081 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1082 {0, 0, 129}, {0, 1, 145},
1085 for(
int x = 0; x < 25; x++)
1086 for(
int y = 0; y < 3; y++)
1091 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1092 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1093 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1094 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1095 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1096 {0, 0, 130}, {-1, 0, 146},
1099 for(
int x = 0; x < 25; x++)
1100 for(
int y = 0; y < 3; y++)
1105 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1106 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1107 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1108 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1109 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1110 {0, 0, 130}, {1, 0, 146},
1113 for(
int x = 0; x < 25; x++)
1114 for(
int y = 0; y < 3; y++)
1119 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1120 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1121 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1122 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1123 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1124 {0, -1, 129}, {1, 0, 130},
1125 {-1, 0, 130}, {0, 1, 145},
1126 {0, -1, 145}, {1, 0, 146},
1129 for(
int x = 0; x < 28; x++)
1130 for(
int y = 0; y < 3; y++)
1145 for(
int x = 0; x < 8; x++)
1146 for(
int y = 0; y < 3; y++)
1161 for(
int x = 0; x < 8; x++)
1162 for(
int y = 0; y < 3; y++)
1177 for(
int x = 0; x < 8; x++)
1178 for(
int y = 0; y < 3; y++)
1193 for(
int x = 0; x < 8; x++)
1194 for(
int y = 0; y < 3; y++)
1199 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1201 for(
int x = 0; x < 4; x++)
1202 for(
int y = 0; y < 3; y++)
1206 {0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1207 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1208 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1209 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1210 140, 144, 145, 146};
1213 {0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1214 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1215 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1216 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1217 141, 144, 145, 146};
1220 {0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1221 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1222 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1223 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1224 141, 144, 146, 145};
1227 {0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1228 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1229 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1230 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1231 140, 144, 146, 145};
1251 delete UGMIt->second;
1325 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1326 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1328 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1335 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1336 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1349 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1350 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1352 {4, 6, 2, 8}, {1, 9, 3, 7},
1354 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1356 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8
1357 }, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1360 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1361 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6
1363 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1
1365 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1
1367 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1368 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1
1370 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1
1373 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1374 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1375 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1376 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1377 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1378 {4, 6, -1, -1}, {2, 8, -1, -1},
1380 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1382 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1384 {4, 6, -1, -1}, {2, 8, -1, -1},
1389 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1390 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1391 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1392 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1395 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1396 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1397 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1399 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1400 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1401 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1403 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1405 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1406 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1407 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1408 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1409 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1410 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1411 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1412 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet
1414 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1415 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1416 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet
1418 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1419 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1421 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1422 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1423 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1424 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1425 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1426 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1427 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1428 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1432 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1433 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1434 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1440 for(
int x = 0; x < 17; x++)
1442 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1444 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1448 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1454 ExistingGraphicLoaded(false), Width(16), Height(16)
1466 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1504 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1508 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1512 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1516 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1539 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1542 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1546 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1550 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1584 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1605 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1619 bool TrackPresent =
false;
1633 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1636 TrackPresent =
true;
1640 return !TrackPresent;
1648 bool TrackPresent =
false;
1657 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1660 TrackPresent =
true;
1665 return !TrackPresent;
1670 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1673 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1674 TrackEraseSuccessfulFlag =
false;
1679 ErasedTrackVectorPosition = -1;
1680 AnsiString SName =
"", ErrorString;
1682 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1688 TrackMapKeyPair.first = HLocInput;
1689 TrackMapKeyPair.second = VLocInput;
1690 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
1701 if(ErrorString !=
"")
1703 throw Exception(ErrorString +
" for EraseTrackElement 1");
1726 ErasedTrackVectorPosition = VecPos;
1727 TrackEraseSuccessfulFlag =
true;
1734 unsigned int VecPos;
1735 InactiveTrackMapKeyPair.first = HLocInput;
1736 InactiveTrackMapKeyPair.second = VLocInput;
1741 VecPos = InactiveTrack2MultiMapIterator->second;
1746 if(ErrorString !=
"")
1748 throw Exception(ErrorString +
" for EraseTrackElement 2A");
1758 TrackEraseSuccessfulFlag =
true;
1778 VecPos = InactiveTrack2MultiMapIterator->second;
1783 if(ErrorString !=
"")
1785 throw Exception(ErrorString +
" for EraseTrackElement 2B");
1807 if(TrackEraseSuccessfulFlag)
1829 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1830 bool PlatAllowedFlag =
false;
1832 TrackLinkingRequiredFlag =
false;
1844 LocationNameEntry.first =
"";
1853 TempTrackElement.
HLoc = HLocInput;
1854 TempTrackElement.
VLoc = VLocInput;
1880 else if(Aspect == 1)
1882 else if(Aspect == 2)
1884 else if(Aspect == 3)
1890 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
1893 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
1895 if(InactiveFoundFlag)
1898 NonStationOrLevelCrossingPresent =
true;
1900 NonStationOrLevelCrossingPresent =
true;
1902 PlatformPresent =
true;
1913 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
1920 PlatAllowedFlag =
true;
1924 PlatAllowedFlag =
true;
1928 PlatAllowedFlag =
true;
1932 PlatAllowedFlag =
true;
1936 TrackLinkingRequiredFlag =
true;
1963 if((FoundFlag && (
NameAllowed.Contains(
TrackVector.at(VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
1964 (!FoundFlag && !InactiveFoundFlag))
1967 TrackLinkingRequiredFlag =
true;
2000 TrackLinkingRequiredFlag =
true;
2012 else if(FoundFlag || InactiveFoundFlag)
2032 bool BothPointFillets =
true;
2046 TrackLinkingRequiredFlag =
true;
2059 bool InternalChecks)
2067 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2068 bool PlatAllowedFlag =
false;
2070 TrackLinkingRequiredFlag =
false;
2082 LocationNameEntry.first =
"";
2089 TempTrackElement.
HLoc = HLocInput;
2090 TempTrackElement.
VLoc = VLocInput;
2091 for(
int x = 0; x < 4; x++)
2095 TempTrackElement.
Conn[x] = -1;
2099 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2110 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2112 if(InactiveFoundFlag)
2115 NonStationOrLevelCrossingPresent =
true;
2117 NonStationOrLevelCrossingPresent =
true;
2119 PlatformPresent =
true;
2130 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2137 PlatAllowedFlag =
true;
2141 PlatAllowedFlag =
true;
2145 PlatAllowedFlag =
true;
2149 PlatAllowedFlag =
true;
2153 TrackLinkingRequiredFlag =
true;
2183 if((FoundFlag && (
NameAllowed.Contains(
TrackVector.at(VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2184 (!FoundFlag && !InactiveFoundFlag))
2187 TrackLinkingRequiredFlag =
true;
2223 TrackLinkingRequiredFlag =
true;
2235 else if(FoundFlag || InactiveFoundFlag)
2255 bool BothPointFillets =
true;
2269 TrackLinkingRequiredFlag =
true;
2297 ShowMessage(
"Gaps must be set before track can be validated");
2306 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2317 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2335 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2342 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2367 std::pair<AnsiString, char>TempMapPair;
2375 TempMapPair.second =
'x';
2388 int NewHLoc, NewVLoc;
2389 bool ConnectionFoundFlag, LinkFoundFlag;
2391 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2393 for(
unsigned int y = 0; y < 4; y++)
2405 ConnectionFoundFlag =
false;
2406 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2412 ConnectionFoundFlag =
true;
2414 LinkFoundFlag =
false;
2415 for(
unsigned int a = 0; a < 4; a++)
2419 LinkFoundFlag =
true;
2434 if(!ConnectionFoundFlag)
2507 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2522 bool UnsetGaps =
false;
2529 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2533 for(
unsigned int y = 0; y < 4; y++)
2545 for(
unsigned int y = 0; y < 4; y++)
2555 for(
unsigned int y = 1; y < 4; y++)
2564 for(
unsigned int y = 0; y < 4; y++)
2577 for(
unsigned int y = 0; y < 4; y++)
2604 int NumberOfActiveElements = 0;
2606 GraphicsFollow =
false;
2610 if(MarkerString[MarkerString.Length()] ==
'1')
2612 GraphicsFollow =
true;
2614 for(
int x = 0; x < NumberOfActiveElements; x++)
2620 TrackElement.
HLoc = TempInt;
2622 TrackElement.
VLoc = TempInt;
2628 TrackElement.
Conn[0] = TempInt;
2648 if((TempInt != -1) && (TempInt < 10))
2654 if((TempInt != -1) && (TempInt < 10))
2667 if(Marker[1] ==
'3')
2671 else if(Marker[1] ==
'2')
2675 else if(Marker[1] ==
'G')
2687 int NumberOfInactiveElements = 0;
2691 for(
int x = 0; x < NumberOfInactiveElements; x++)
2697 TrackElement.
HLoc = TempInt;
2699 TrackElement.
VLoc = TempInt;
2705 bool LocError =
false;
2734 for(
int x = 0; x < NumberOfGraphics; x++)
2745 bool FileError =
false;
2747 for(
int x = 0; x < NumberOfGraphics; x++)
2760 UGME.second =
new TPicture;
2761 UGME.second->LoadFromFile(
UGME.first);
2764 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
2771 catch(
const EInvalidGraphic &e)
2774 " has an incorrect file format, graphics can't be loaded. Ensure that all graphic files are valid with extension .bmp, .gif, .jpg, or .png");
2781 delete UGMIt->second;
2786 catch(
const Exception &e)
2788 ShowMessage(
"Unable to load file, ensure that this graphic file exists: " + UGI.
FileName +
2789 ", and that it is has extension .bmp, .gif, .jpg, or .png. Graphics can't be loaded.");
2796 delete UGMIt->second;
2804 bool FoundInMap =
false;
2823 UGME.second =
new TPicture;
2824 UGME.second->LoadFromFile(
UGME.first);
2827 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
2834 catch(
const EInvalidGraphic &e)
2837 " has an incorrect file format, graphics can't be loaded. Ensure that all graphic files are valid with extension .bmp, .gif, .jpg, or .png");
2844 delete UGMIt->second;
2849 catch(
const Exception &e)
2851 ShowMessage(
"Unable to load file, ensure that this graphic file exists: " + UGI.
FileName +
2852 ", and that it is has extension .bmp, .gif, .jpg, or .png");
2859 delete UGMIt->second;
2884 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
2888 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
2890 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
2893 VecFile << x <<
'\n';
2894 VecFile << TrackElement.
SpeedTag <<
'\n';
2895 VecFile << TrackElement.
HLoc <<
'\n';
2896 VecFile << TrackElement.
VLoc <<
'\n';
2900 VecFile << TrackElement.
Conn[0] <<
'\n';
2904 VecFile << TrackElement.
Attribute <<
'\n';
2909 VecFile << int(1) <<
'\n';
2911 VecFile << int(0) <<
'\n';
2913 VecFile << TrackElement.
Length01 <<
'\n';
2914 VecFile << TrackElement.
Length23 <<
'\n';
2917 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
2924 VecFile <<
"3*****" <<
'\0' <<
'\n';
2928 VecFile <<
"2*****" <<
'\0' <<
'\n';
2932 VecFile <<
"G*****" <<
'\0' <<
'\n';
2936 VecFile <<
"4*****" <<
'\0' <<
'\n';
2941 VecFile <<
"******" <<
'\0' <<
'\n';
2946 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
2950 VecFile << x <<
'\n';
2951 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
2952 VecFile << InactiveTrackElement.
HLoc <<
'\n';
2953 VecFile << InactiveTrackElement.
VLoc <<
'\n';
2954 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
2955 VecFile <<
"******" <<
'\0' <<
'\n';
2970 GraphicsFollow =
false;
2972 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
2978 AnsiString MarkerString;
2985 if(MarkerString[MarkerString.Length()] ==
'1')
2987 GraphicsFollow =
true;
2989 for(
int x = 0; x < NumberOfActiveElements; x++)
2997 int SpeedTag = TempInt;
3004 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3010 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3015 if((SpeedTag > 87) && (SpeedTag < 96))
3018 if((TempInt < -1) || (TempInt > 3))
3024 if((TempInt < -1) || (TempInt > 999999))
3030 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3031 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3034 if((TempInt < -1) || (TempInt > 5))
3040 if((SpeedTag >= 68) && (SpeedTag <= 75))
3043 if((TempInt != 0) && (TempInt != 1))
3050 if((TempInt < -1) || (TempInt > 999999))
3056 if((TempInt < -1) || (TempInt > 999999))
3062 if((TempInt < -1) || (TempInt > 999999))
3068 if((TempInt < -1) || (TempInt > 999999))
3089 int NumberOfInactiveElements = 0;
3092 if(NumberOfInactiveElements < 0)
3102 for(
int x = 0; x < NumberOfInactiveElements; x++)
3116 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3122 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3149 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3155 AnsiString FileName;
3157 for(
int x = 0; x < NumberOfGraphics; x++)
3159 TPicture *TempPicture =
new TPicture;
3167 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3180 catch(
const EInvalidGraphic &e)
3182 ShowMessage(FileName +
3183 " has an incorrect file format, graphics can't be loaded. Ensure that all graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3188 catch(
const Exception &e)
3190 ShowMessage(
"Unable to load file, ensure that " + FileName +
3191 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3209 for(
int x = 0; x < VecSize; x++)
3232 for(
int x = 0; x < VecSize; x++)
3254 for(
int x = 0; x < VecSize; x++)
3308 for(
int x = 0; x < VecSize; x++)
3365 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3376 if(BothPointFilletsAndBasicLCs)
3451 Bitmap->Canvas->CopyMode = cmSrcCopy;
3453 Graphics::TBitmap *GraphicOutput;
3624 for(
int x = 0; x < 40; x++)
3643 Graphics::TBitmap *GraphicPtr;
3652 Graphics::TBitmap* SignalPlatformGraphic;
3685 if(OldTransparentColour !=
clB5G5R5)
3708 Bitmap->Canvas->CopyMode = cmSrcCopy;
3736 Bitmap->Canvas->CopyMode = cmSrcCopy;
3738 Graphics::TBitmap *GraphicOutput;
3748 if(BaseElement == 1)
3836 for(
int x = 0; x < 40; x++)
3855 Graphics::TBitmap *GraphicPtr;
3864 Graphics::TBitmap* SignalPlatformGraphic;
3925 for(
int x = 0; x < 40; x++)
3933 Graphics::TBitmap* SignalPlatformGraphic;
3954 if(OldTransparentColour !=
clB5G5R5)
3968 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4038 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4052 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4077 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4102 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4132 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4166 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4202 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4217 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4247 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4254 throw Exception(
"Error - Map & Vector different sizes");
4256 unsigned int NonZeroCount = 0;
4258 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4265 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4272 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4276 TrackMapEntry.first = TrackMapKeyPair;
4277 TrackMapEntry.second = x;
4278 if(!(
TrackMap.insert(TrackMapEntry).second))
4280 throw Exception(
"Error - map insertion failure, TrackVector in error");
4284 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4286 for(
unsigned int y = 0; y < 4; y++)
4311 THVPair GapMapKeyPair, GapMapValuePair;
4314 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4320 GapMapEntry.first = GapMapKeyPair;
4323 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4327 GapMapEntry.second = GapMapValuePair;
4330 GapMap.insert(GapMapEntry);
4343 bool CheckForLinks =
false;
4345 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4355 "Footbridge or underpass connection error. Each end must connect to a platform, concourse or other footbridge or underpass, and they can't connect to each other");
4363 for(
unsigned int y = 0; y < 4; y++)
4365 CheckForLinks =
false;
4377 bool ConnectionFoundFlag;
4381 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4387 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4394 if(ConnectionFoundFlag)
4398 bool LinkFoundFlag =
false;
4401 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
4407 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4413 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
4421 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
4427 ShowMessage(
"Signal facing a bridge - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message won't be shown again.");
4434 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4437 CheckForLinks =
true;
4440 for(
unsigned int a = 0; a < 4; a++)
4449 LinkFoundFlag =
true;
4462 throw Exception(
"Error in final track linkage - invalid link");
4476 throw Exception(
"Error in final track linkage - connection not found");
4488 bool ConnErrorFlag =
false;
4490 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4493 ConnErrorFlag =
true;
4495 ConnErrorFlag =
true;
4497 ConnErrorFlag =
true;
4499 ConnErrorFlag =
true;
4502 if(
TrackVector.at(x).ActiveTrackElementName ==
"")
4504 if((
TrackVector.at(x).StationEntryStopLinkPos1 != -1) || (
TrackVector.at(x).StationEntryStopLinkPos2 != -1))
4506 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
4515 throw Exception(
"ConnError in LinkTrack - Final");
4519 throw Exception(
"ConnError in LinkTrack - Precheck");
4523 bool CLkErrorFlag =
false;
4525 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4528 CLkErrorFlag =
true;
4530 CLkErrorFlag =
true;
4532 CLkErrorFlag =
true;
4534 CLkErrorFlag =
true;
4541 throw Exception(
"CLkError in LinkTrack - Final");
4545 throw Exception(
"CLkError in LinkTrack - Precheck");
4550 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4573 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4588 for(
unsigned int y = 0; y < 4; y++)
4601 bool ConnectionFoundFlag;
4607 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4614 if(ConnectionFoundFlag)
4617 bool LinkFoundFlag =
false;
4674 for(
unsigned int a = 0; a < 4; a++)
4683 LinkFoundFlag =
true;
4691 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
4701 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
4713 bool ConnErrorFlag =
false;
4715 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4718 ConnErrorFlag =
true;
4720 ConnErrorFlag =
true;
4722 ConnErrorFlag =
true;
4724 ConnErrorFlag =
true;
4727 if(
TrackVector.at(x).ActiveTrackElementName ==
"")
4729 if((
TrackVector.at(x).StationEntryStopLinkPos1 != -1) || (
TrackVector.at(x).StationEntryStopLinkPos2 != -1))
4731 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
4740 throw Exception(
"ConnError in LinkTrack - Final");
4744 throw Exception(
"ConnError in LinkTrack - Precheck");
4748 bool CLkErrorFlag =
false;
4750 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4753 CLkErrorFlag =
true;
4755 CLkErrorFlag =
true;
4757 CLkErrorFlag =
true;
4759 CLkErrorFlag =
true;
4766 throw Exception(
"CLkError in LinkTrack - Final");
4770 throw Exception(
"CLkError in LinkTrack - Precheck");
4775 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4798 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4816 for(
unsigned int y = 0; y < 4; y++)
4829 bool ConnectionFoundFlag =
false;
4831 if(ConnectionFoundFlag)
4835 bool LinkFoundFlag =
false;
4855 for(
unsigned int a = 0; a < 4; a++)
4864 LinkFoundFlag =
true;
4884 bool ConnErrorFlag =
false;
4886 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4889 ConnErrorFlag =
true;
4891 ConnErrorFlag =
true;
4893 ConnErrorFlag =
true;
4895 ConnErrorFlag =
true;
4903 bool CLkErrorFlag =
false;
4905 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4908 CLkErrorFlag =
true;
4910 CLkErrorFlag =
true;
4912 CLkErrorFlag =
true;
4914 CLkErrorFlag =
true;
4931 int Position1, Position2;
4937 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
4939 int HLoc1 = GapMapPtr->first.first;
4940 int VLoc1 = GapMapPtr->first.second;
4941 int HLoc2 = GapMapPtr->second.first;
4942 int VLoc2 = GapMapPtr->second.second;
4945 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
4949 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
4953 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
4957 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
4975 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
4976 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
4986 bool FoundFlag =
false;
4998 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
4999 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5000 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5021 bool FoundFlag =
false;
5034 TrackMapKeyPair.first = TrackElement.
HLoc;
5035 TrackMapKeyPair.second = TrackElement.
VLoc;
5036 TrackMapEntry.first = TrackMapKeyPair;
5041 LocationNameEntry.second = -(int)(
TrackVector.size());
5073 TrackMapKeyPair.first = HLoc;
5074 TrackMapKeyPair.second = VLoc;
5075 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5085 return TrackMapPtr->second;
5098 TrackMapKeyPair.first = HLoc;
5099 TrackMapKeyPair.second = VLoc;
5100 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5103 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5104 throw Exception(Message);
5119 THVPair InactiveTrackMapKeyPair;
5122 InactiveTrackMapKeyPair.first = HLoc;
5123 InactiveTrackMapKeyPair.second = VLoc;
5127 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5128 throw Exception(Message);
5142 bool Present =
true;
5146 TrackMapKeyPair.first = HLoc;
5147 TrackMapKeyPair.second = VLoc;
5148 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5163 bool Present =
true;
5164 THVPair InactiveTrackMapKeyPair;
5167 InactiveTrackMapKeyPair.first = HLoc;
5168 InactiveTrackMapKeyPair.second = VLoc;
5186 THVPair InactiveTrackMapKeyPair;
5191 InactiveTrackMapKeyPair.first = HLoc;
5192 InactiveTrackMapKeyPair.second = VLoc;
5201 if(InactiveTrackRange.first == InactiveTrackRange.second)
5210 RetPair.first = InactiveTrackRange.first->second;
5211 RetPair.second = (--InactiveTrackRange.second)->second;
5224 AnsiString(DivergingPosition));
5235 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5236 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5237 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5238 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5239 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5240 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5241 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5242 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5243 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5244 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5245 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5246 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5280 throw Exception(
"Error, Wrong track type in PlotGap");
5282 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5286 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
5290 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
5294 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
5298 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
5302 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
5306 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
5310 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
5314 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
5318 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
5322 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
5326 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
5330 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
5334 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
5338 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
5342 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
5356 throw Exception(
"Error, Wrong track type in PlotPoints");
5367 else if(TrackElement.
SpeedTag < 132)
5385 else if(TrackElement.
SpeedTag < 132)
5417 throw Exception(
"Error, Wrong track type in PlotSignal");
5419 for(
int x = 0; x < 40; x++)
5490 for(
int x = 0; x < 40; x++)
5497 Graphics::TBitmap* SignalPlatformGraphic;
5584 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
5592 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
5600 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
5608 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
5626 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
5628 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
5630 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
5633 if(BaseElementSpeedTag == 1)
5637 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
5644 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
5652 Graphics::TBitmap *RouteGraphic;
5667 if(UpStep == DownStep)
5670 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
5673 else if((DownStep - UpStep) == 1)
5678 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
5681 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
5687 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
5690 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
5699 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
5702 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
5705 else if(DownStep == 0)
5708 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
5711 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
5717 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
5720 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
5723 for(
int x = (UpStep + 1); x < DownStep; x++)
5727 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
5729 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
5742 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
5749 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
5755 Graphics::TBitmap *RouteGraphic;
5772 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
5775 else if((RStep - LStep) == 1)
5780 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
5783 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
5789 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
5792 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
5801 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
5804 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
5810 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
5813 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
5819 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
5822 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
5825 for(
int x = (LStep + 1); x < RStep; x++)
5829 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
5831 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
5847 AnsiString(HLoc) +
"," + AnsiString(VLoc));
5850 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
5852 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
5854 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
5857 if(BaseElementSpeedTag == 1)
5861 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
5868 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
5874 if(UpStep == DownStep)
5878 else if((DownStep - UpStep) == 1)
5887 for(
int x = (UpStep + 1); x < DownStep; x++)
5893 for(
int x = UpStep; x <= DownStep; x++)
5906 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
5913 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
5923 else if((RStep - LStep) == 1)
5932 for(
int x = (LStep + 1); x < RStep; x++)
5938 for(
int x = LStep; x <= RStep; x++)
5957 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
5959 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
5961 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
5964 if(BaseElementSpeedTag == 1)
5968 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
5975 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
5981 for(
int x = UpStep; x < (DownStep + 1); x++)
5996 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
6003 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
6009 for(
int x = LStep; x < (RStep + 1); x++)
6028 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6031 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
6033 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6035 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
6040 if(BaseElementSpeedTag == 1)
6044 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
6051 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
6057 for(
int x = UpStep; x <= DownStep; x++)
6071 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
6078 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
6084 for(
int x = LStep; x <= RStep; x++)
6100 Graphics::TBitmap *RouteGraphic;
6101 Graphics::TBitmap *BaseGraphic;
6103 if(BaseElementSpeedTag == 1)
6115 RouteGraphic = BaseGraphic;
6129 RouteGraphic = BaseGraphic;
6133 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
6137 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6139 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6145 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
6148 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6153 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
6157 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
6159 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
6165 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
6168 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
6293 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
6297 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
6328 "," + AnsiString(VLoc));
6332 int DummyRouteNumber;
6334 TrainPresent =
false;
6338 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
6340 TrackMapKeyPair.first = HLoc;
6341 TrackMapKeyPair.second = VLoc + UpStep;
6342 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
6351 TrainPresent =
true;
6360 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
6362 TrackMapKeyPair.first = HLoc;
6363 TrackMapKeyPair.second = VLoc + DownStep;
6364 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
6373 TrainPresent =
true;
6382 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
6384 TrackMapKeyPair.first = HLoc + LeftStep;
6385 TrackMapKeyPair.second = VLoc;
6386 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
6395 TrainPresent =
true;
6404 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
6406 TrackMapKeyPair.first = HLoc + RightStep;
6407 TrackMapKeyPair.second = VLoc;
6408 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
6417 TrainPresent =
true;
6434 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
6441 else if(TrackElement.
SpeedTag < 132)
6459 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
6476 AnsiString(ScreenPosV));
6491 AnsiString(ScreenPosV));
6502 AnsiString(VPosTrue));
6516 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
6528 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
6529 " in TrackMap, Caller=" + (AnsiString)Caller);
6531 if(MapVecPos != (
int)a)
6533 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
6534 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
6535 (AnsiString)Caller);
6541 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
6542 " Caller=" + (AnsiString)Caller);
6562 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
6563 " in InactiveMap, Caller=" + (AnsiString)Caller);
6565 if((InactivePair.first != a) && (InactivePair.second != a))
6567 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
6568 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
6569 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
6574 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
6575 " Caller=" + (AnsiString)Caller);
6585 int Position1, Position2;
6591 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
6593 int HLoc1 = GapMapPtr->first.first;
6594 int VLoc1 = GapMapPtr->first.second;
6595 int HLoc2 = GapMapPtr->second.first;
6596 int VLoc2 = GapMapPtr->second.second;
6599 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
6603 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
6607 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
6611 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
6615 unsigned int GapCount = 0;
6617 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
6623 if((
GapMap.size() * 2) != GapCount)
6625 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
6626 (AnsiString)Caller);
6636 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
6640 throw Exception(
"Error - TrackFinished with erase element still present");
6645 AnsiString IDString;
6647 if(TrackElement.
HLoc < 0)
6648 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
6650 IDString = AnsiString(TrackElement.
HLoc) +
"-";
6651 if(TrackElement.
VLoc < 0)
6652 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
6654 IDString += AnsiString(TrackElement.
VLoc);
6667 for(
int x = 1; x < String.Length() + 1; x++)
6669 if(String.IsDelimiter(
"-", x))
6674 if(x == String.Length())
6677 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
6685 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
6689 if(DelimPos == String.Length())
6692 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
6696 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
6699 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
6705 if(String.SubString(1, 1) !=
"N")
6707 for(
int x = 1; x < DelimPos; x++)
6709 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
6712 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
6718 if(String.SubString(1, 1) ==
"N")
6720 for(
int x = 2; x < DelimPos; x++)
6722 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
6725 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
6731 if(String.SubString(1, 1) ==
"N")
6732 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
6734 HLoc = String.SubString(1, DelimPos - 1).ToInt();
6736 if(String.SubString(DelimPos + 1, 1) !=
"N")
6738 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
6740 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
6743 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
6749 if(String.SubString(DelimPos + 1, 1) ==
"N")
6751 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
6753 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
6756 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
6762 if(String.SubString(DelimPos + 1, 1) ==
"N")
6763 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
6765 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
6770 TrackMapPtr =
TrackMap.find(HVPair);
6774 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
6779 return TrackMapPtr->second;
6790 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
6791 int HLoc = TrackElement.
HLoc;
6792 int VLoc = TrackElement.
VLoc;
6895 AnsiString(SpeedTag));
6906 if(HVRange.first == HVRange.second)
6912 HVIt1 = HVRange.first;
6916 if(--HVRange.second != HVRange.first)
6918 HVIt2 = HVRange.second;
6922 HVIt2->second).
SpeedTag == SpeedTag)))
6942 AnsiString(SpeedTag));
7008 AnsiString TestString1, TestString2;
7013 throw Exception(
"LNPendingList size not 1 on entry");
7015 int CurrentElementNumber;
7021 int H = CurrentElement->HLoc;
7022 int V = CurrentElement->VLoc;
7023 int Tag = CurrentElement->SpeedTag;
7029 for(
int x = 0; x < 25; x++)
7039 for(
int x = 0; x < 25; x++)
7049 for(
int x = 0; x < 25; x++)
7059 for(
int x = 0; x < 25; x++)
7069 for(
int x = 0; x < 28; x++)
7079 for(
int x = 0; x < 8; x++)
7089 for(
int x = 0; x < 8; x++)
7099 for(
int x = 0; x < 4; x++)
7109 for(
int x = 0; x < 8; x++)
7119 for(
int x = 0; x < 8; x++)
7132 if(CurrentElementNumber > -1)
7137 if((ExistingName !=
"") && (ExistingName != LocationName))
7151 AddName(1, CurrentElement, LocationName);
7155 LNDone2MultiMapEntry.first = HVPair;
7166 bool FoundFlag, ErasedFlag =
false;
7168 if(SNRange.first != SNRange.second)
7172 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
7179 TVIt->LocationName =
"";
7180 TVIt->ActiveTrackElementName =
"";
7215 AnsiString(SpeedTag));
7225 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
7232 int MapPos = -1 - Position;
7236 FoundElement = MapPos;
7252 FoundElement = IMPair.first;
7261 FoundElement = IMPair.second;
7282 AnsiString OldName = TrackElement->LocationName, ErrorString;
7284 TrackElement->LocationName = Name;
7285 int HLoc = TrackElement->HLoc;
7286 int VLoc = TrackElement->VLoc;
7300 if(ErrorString !=
"")
7302 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
7326 if(LNDone2MultiMapIterator->second == MapPos)
7353 if(*LNPendingListIterator == MapPos)
7419 if(LocationName ==
"")
7430 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7435 ActiveTrackElementNameMapEntry.first =
Track->
TrackVector.at(x).ActiveTrackElementName;
7436 ActiveTrackElementNameMapEntry.second = 0;
7458 bool FoundFlag, ErasedFlag =
false;
7462 if(SNRange.first != SNRange.second)
7465 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
7468 TVIt->LocationName =
"";
7469 TVIt->ActiveTrackElementName =
"";
7501 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
7503 AnsiString LocationName;
7508 for(
int x = 0; x < 25; x++)
7518 else if(SpeedTag == 77)
7520 for(
int x = 0; x < 25; x++)
7530 else if(SpeedTag == 78)
7532 for(
int x = 0; x < 25; x++)
7542 else if(SpeedTag == 79)
7544 for(
int x = 0; x < 25; x++)
7554 else if(SpeedTag == 96)
7556 for(
int x = 0; x < 28; x++)
7566 else if(SpeedTag == 129)
7568 for(
int x = 0; x < 8; x++)
7578 else if(SpeedTag == 130)
7580 for(
int x = 0; x < 8; x++)
7590 else if(SpeedTag == 145)
7592 for(
int x = 0; x < 8; x++)
7602 else if(SpeedTag == 146)
7604 for(
int x = 0; x < 8; x++)
7614 else if(SpeedTag == 131)
7616 for(
int x = 0; x < 4; x++)
7639 AnsiString(SpeedTag));
7651 if(TempElement->LocationName !=
"")
7653 LocationName = TempElement->LocationName;
7654 FoundElement = IMPair.first;
7662 if(TempElement->LocationName !=
"")
7664 LocationName = TempElement->LocationName;
7665 FoundElement = IMPair.second;
7678 if(TempElement->LocationName !=
"")
7680 LocationName = TempElement->LocationName;
7681 FoundElement = -1 - Position;
7697 unsigned int Count = 0;
7705 AnsiString SName, TName, ErrorString;
7707 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7713 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
7714 AnsiString(Caller));
7727 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
7728 AnsiString(Caller));
7735 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
7736 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
7742 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7748 if(ErrorString !=
"")
7750 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
7752 if(SNIt->second != -1 - (
int)x)
7754 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
7755 AnsiString(Caller));
7761 bool FoundFlag =
false;
7770 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackVector.at(x).HLoc) +
" & V " +
7771 AnsiString(
TrackVector.at(x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
7775 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackVector.at(x).HLoc) +
7776 " & V " + AnsiString(
TrackVector.at(x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
7777 AnsiString(Caller));
7782 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackVector.at(x).HLoc) +
" & V " +
7783 AnsiString(
TrackVector.at(x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
7793 if(ErrorString !=
"")
7795 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
7797 if(SNIt->second != (
int)x)
7799 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
7800 AnsiString(Caller));
7810 AnsiString &ErrorString)
7818 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
7820 bool FoundFlag =
false;
7824 if(SNRange.first == SNRange.second)
7826 ErrorString =
"Error, Name " + LocationName +
" not found in map";
7828 return SNRange.first;
7832 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
7834 if(SNIterator->second < 0)
7836 int TVPos = -1 - SNIterator->second;
7838 if(TVIt == TrackElement)
7847 int ITVPos = SNIterator->second;
7849 if(ITVIt == TrackElement)
7859 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
7875 LocationNameEntry.first = NewName;
7876 LocationNameEntry.second = SNIterator->second;
7890 int TruePos = -1 - Position;
7894 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
7904 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
7927 InactiveTrack2MultiMapIterator++)
7929 if(InactiveTrack2MultiMapIterator->second > VecPos)
7930 InactiveTrack2MultiMapIterator->second--;
7937 LocationNameMultiMapIterator++)
7939 if(LocationNameMultiMapIterator->second < 0)
7941 if(LocationNameMultiMapIterator->second > (
int)VecPos)
7942 LocationNameMultiMapIterator->second--;
7963 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
7965 if(TrackMapIterator->second > VecPos)
7966 TrackMapIterator->second--;
7973 LocationNameMultiMapIterator++)
7975 if(LocationNameMultiMapIterator->second >= 0)
7979 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
7980 LocationNameMultiMapIterator->second++;
7983 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7989 if(TkEl.
Conn[0] ==
int(VecPos))
7994 if(TkEl.
Conn[0] >
int(VecPos))
7996 if(TkEl.
Conn[0] > -1)
8020 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
8026 LocationNameEntry.second = -1 - TVPos;
8037 LocationNameEntry.second = ITVPos;
8079 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8111 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8135 AnsiString((
short)FirstTrack));
8136 bool LengthDifferent =
false, SpeedDifferent =
false;
8144 int EXArray[16][2] =
8146 {2, 4}, {6, 2}, {8, 6}, {4, 8},
8147 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
8150 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
8151 Graphics::TBitmap *Bitmap;
8155 InLink = TrackElement.
Link[0];
8156 OutLink = TrackElement.
Link[1];
8160 InLink = TrackElement.
Link[2];
8161 OutLink = TrackElement.
Link[3];
8164 for(
int x = 0; x < 16; x++)
8166 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
8171 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
8189 else if(TrackElement.
SpeedTag == 54)
8191 else if(TrackElement.
SpeedTag == 55)
8198 else if(TrackElement.
SpeedTag == 58)
8200 else if(TrackElement.
SpeedTag == 59)
8203 else if(Index == 14)
8207 else if(TrackElement.
SpeedTag == 52)
8209 else if(TrackElement.
SpeedTag == 57)
8212 else if(Index == 15)
8216 else if(TrackElement.
SpeedTag == 53)
8218 else if(TrackElement.
SpeedTag == 56)
8228 if(LengthDifferent && SpeedDifferent)
8269 else if(LengthDifferent && !SpeedDifferent)
8363 AnsiString((
short)FirstTrack));
8364 LengthDifferent =
false;
8365 SpeedDifferent =
false;
8370 LengthDifferent =
true;
8374 SpeedDifferent =
true;
8376 if(LengthDifferent || SpeedDifferent)
8389 LengthDifferent =
true;
8393 SpeedDifferent =
true;
8395 if(LengthDifferent || SpeedDifferent)
8408 LengthDifferent =
true;
8412 SpeedDifferent =
true;
8414 if(LengthDifferent || SpeedDifferent)
8494 AnsiString TempName;
8495 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
8496 bool ForwardSet, ReverseSet;
8498 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8503 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8541 for(
int y = 0; y < 2; y++)
8572 StartElement = TempElement;
8573 StartVecPos = VecPos;
8577 StartEntryPos = 1 - Dir;
8586 VecPos = TempElement.
Conn[1 - EntryPos];
8587 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
8589 EntryPos = TempEntryPos;
8617 ForwardNumber = ((Count + 1) / 2) + 1;
8618 ReverseNumber = (Count - ForwardNumber) + 1;
8621 TempElement = StartElement;
8622 VecPos = StartVecPos;
8623 if(Count == ForwardNumber)
8628 if(Count == ReverseNumber)
8636 VecPos = TempElement.
Conn[1 - EntryPos];
8637 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
8639 EntryPos = TempEntryPos;
8641 if(Count == ForwardNumber)
8646 if(Count == ReverseNumber)
8658 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8660 if(
TrackVector.at(x).StationEntryStopLinkPos1 == 5)
8664 if(
TrackVector.at(x).StationEntryStopLinkPos2 == 5)
8772 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8808 if((TextH / 16) - 1 <
HLocMin)
8810 if((TextH / 16) + 1 >
HLocMax)
8812 if((TextV / 16) - 1 <
VLocMin)
8814 if((TextV / 16) + 1 >
VLocMax)
8834 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
8835 bool &UserGraphicFoundFlag)
8838 TUserGraphicVector::iterator UserGraphicPtr;
8840 UserGraphicFoundFlag =
false;
8847 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
8848 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
8850 UserGraphicItem = x;
8851 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
8852 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
8853 UserGraphicFoundFlag =
true;
8869 int SpeedTag = TrackElement.
SpeedTag;
8873 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
8922 return GraphicOutput;
8930 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
8932 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
8945 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
8946 " in InactiveTrackElementAt");
8957 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
8959 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
8984 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
8985 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
8989 if(SNRange.first == SNRange.second)
8994 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8996 if(SNIterator->second < 0)
9002 HVPair.first = InactiveElement.
HLoc;
9003 HVPair.second = InactiveElement.
VLoc;
9007 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
9009 int TVPos =
TrackMap.find(HVPair)->second;
9012 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
9018 FirstNamedExitPos = 0;
9022 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
9023 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
9026 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
9028 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
9029 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
9030 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
9033 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
9043 FirstNamedExitPos = 1;
9047 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
9048 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
9051 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
9053 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
9054 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
9055 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
9058 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
9073 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
9087 AnsiString(FirstNamedElementPos));
9088 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
9089 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
9091 SecondNamedElementPos = -1;
9092 FirstNamedLinkedElementPos = -1;
9093 SecondNamedLinkedElementPos = -1;
9097 if(SNRange.first == SNRange.second)
9102 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9104 if(SNIterator->second < 0)
9110 HVPair.first = InactiveElement.
HLoc;
9111 HVPair.second = InactiveElement.
VLoc;
9123 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
9127 int TVPos =
TrackMap.find(HVPair)->second;
9128 if(TVPos != FirstNamedElementPos)
9132 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
9138 FirstNamedExitPos = 0;
9142 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
9143 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
9146 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
9148 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
9149 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
9150 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
9153 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
9155 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
9156 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
9157 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
9166 FirstNamedExitPos = 1;
9170 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
9171 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
9174 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
9176 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
9177 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
9178 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
9181 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
9183 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
9184 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
9185 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
9205 if(SNRange.first != SNRange.second)
9207 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9209 if(SNIterator->second < 0)
9229 "," + AnsiString(SpeedTag));
9240 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
9266 else if(SpeedTag == 69)
9288 else if(SpeedTag == 70)
9310 else if(SpeedTag == 71)
9343 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
9344 if(NextEntryPos < 0)
9357 if(NextEntryPos > 1)
9376 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
9388 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
9389 bool FoundFlag =
false;
9404 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
9405 bool FoundFlag =
false;
9424 VPosHi = 16 * VLocHi;
9425 VPosLo = 16 * VLocLo;
9444 AnsiString(EndTVPosition));
9455 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
9456 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
9457 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
9458 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
9460 if(Link0Squares <= Link1Squares)
9477 AnsiString(LinkPos));
9496 if((LinkPos == 1) && (TE.
Attribute == 0))
9501 else if(LinkPos == 1)
9507 else if((LinkPos == 3) && (TE.
Attribute == 1))
9512 else if(LinkPos == 3)
9519 else if(LinkPos == 0)
9524 else if(LinkPos == 1)
9529 else if(LinkPos == 2)
9534 else if(LinkPos == 3)
9539 throw Exception(
"Error, failure in GetExitPos");
9588 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
9592 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
9632 "," + AnsiString(DiagonalLinkNumber));
9637 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
9643 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
9649 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
9655 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
9672 AnsiString JustFileName =
"";
9677 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
9684 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
9703 typedef std::list<int> TNamePosList;
9704 TNamePosList NamePosList;
9705 typedef TNamePosList::iterator TNPLIt;
9707 typedef std::list<int> TOnePlatList;
9708 TOnePlatList OnePlatList;
9709 typedef TOnePlatList::iterator TOPLIt;
9712 NamePosList.clear();
9713 OnePlatList.clear();
9714 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9716 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
9718 NamePosList.push_back(x);
9723 if(!NamePosList.empty())
9725 OnePlatList.push_back(NamePosList.back());
9726 NamePosList.pop_back();
9729 while(!OnePlatList.empty())
9731 TempInt = OnePlatList.front();
9734 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
9735 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
9737 OnePlatList.push_back(TempElement.
Conn[0]);
9738 NamePosList.erase(NPLIt);
9740 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
9741 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
9743 OnePlatList.push_back(TempElement.
Conn[1]);
9744 NamePosList.erase(NPLIt);
9747 OnePlatList.erase(OnePlatList.begin());
9748 if(OnePlatList.empty())
9751 if(!NamePosList.empty())
9753 OnePlatList.push_back(NamePosList.back());
9754 NamePosList.pop_back();
9771 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
9786 throw Exception(
"Return value negative in call to LastElementNumber");
9798 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
9812 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
9824 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
9825 " in GetModifiablePrefDirElementAt");
9835 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
9837 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
9847 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
9849 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
9866 int TrackVectorPosition;
9918 FinishElement =
false;
9919 int TrackVectorPosition;
9942 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
9953 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
9976 for(
int x = 0; x < 4; x++)
9999 FinishElement =
true;
10007 for(
int x = 0; x < 4; x++)
10019 FinishElement =
true;
10027 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
10034 .ELinkPos] ==
Lead))
10050 FinishElement =
true;
10069 FinishElement =
true;
10088 FinishElement =
true;
10103 FinishElement =
true;
10112 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
10128 FinishElement =
true;
10134 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
10157 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
10158 int VectorCount = 0;
10162 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
10164 for(
int x = 0; x < VectorCount; x++)
10169 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
10173 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
10174 SearchElement.
ELinkPos = NextELinkPos;
10187 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
10189 SearchElement.
XLinkPos = NextXLinkPos;
10215 for(
int x = 0; x < VectorCount; x++)
10225 for(
int x = 0; x < VectorCount; x++)
10237 for(
int x = 0; x < VectorCount; x++)
10249 for(
int x = 0; x < VectorCount; x++)
10258 for(
int x = 0; x < VectorCount; x++)
10267 SearchElement.
XLink = SearchElement.
Link[1];
10286 SearchElement.
XLink = SearchElement.
Link[3];
10299 for(
int x = 0; x < VectorCount; x++)
10311 XLinkPos = NextXLinkPos;
10312 CurrentTrackElement = SearchElement;
10331 throw Exception(
"Error, SearchVector empty");
10338 for(
int x = 0; x < 4; x++)
10383 throw Exception(
"Error in EntryExitNumber 1");
10403 if(PrefDirElement.
XLink == -1)
10411 if(PrefDirElement.
XLink != -1)
10415 throw Exception(
"Error in EntryExitNumber 2");
10451 LeadingPoints =
false;
10479 LeadingPoints =
true;
10495 AnsiString ErrorString;
10496 bool Error =
false;
10503 ErrorString =
"HLoc";
10509 ErrorString =
"VLoc";
10515 ErrorString =
"ELink";
10521 ErrorString =
"ELinkPos";
10527 ErrorString =
"XLink";
10533 ErrorString =
"XLinkPos";
10539 ErrorString =
"Tag";
10545 ErrorString =
"TrackVectorPosition";
10551 ErrorString =
"EXNumber";
10558 ErrorString =
"CheckCount";
10565 ErrorString =
"EntryGraphicPtr";
10571 ErrorString =
"EntryDirectionGraphicPtr";
10580 ErrorString =
"Last XLink not connected to this element";
10587 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
10611 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
10668 AnsiString((
short)BuildingPrefDir));
10671 if(PrefDirSize() == 0)
10676 for(
unsigned int x = 0; x < PrefDirSize(); x++)
10688 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
10700 if(x == (PrefDirSize() - 1))
10709 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
10711 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
10712 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
10713 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
10715 if(PrefDirSize() > 1)
10717 unsigned int LatestPos = PrefDirSize() - 1;
10718 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
10719 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
10720 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
10742 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
10745 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
10749 H = MMIT->first.first;
10750 V = MMIT->first.second;
10753 if(PrefDirPos0 > -1)
10755 if(PrefDirPos1 > -1)
10757 if(PrefDirPos2 > -1)
10759 if(PrefDirPos3 > -1)
10761 if(PrefDirPos3 > -1)
10776 else if(PrefDirPos2 > -1)
10815 else if(PrefDirPos1 > -1)
10836 else if(PrefDirPos0 > -1)
10855 int NumberOfPrefDirElements = 0;
10858 for(
int x = 0; x < NumberOfPrefDirElements; x++)
10860 VecFile >> TempInt;
10863 VecFile >> TempInt;
10864 LoadPrefDirElement.
ELink = TempInt;
10865 VecFile >> TempInt;
10866 LoadPrefDirElement.
ELinkPos = TempInt;
10867 VecFile >> TempInt;
10868 LoadPrefDirElement.
XLink = TempInt;
10869 VecFile >> TempInt;
10870 LoadPrefDirElement.
XLinkPos = TempInt;
10871 VecFile >> TempInt;
10872 LoadPrefDirElement.
EXNumber = TempInt;
10873 VecFile >> TempInt;
10878 if(!(LoadPrefDirElement.
IsARoute))
10904 int NumberOfPrefDirElements = 0;
10907 for(
int x = 0; x < NumberOfPrefDirElements; x++)
10909 VecFile >> TempInt;
10910 VecFile >> TempInt;
10913 VecFile >> TempInt;
10914 LoadPrefDirElement.
ELink = TempInt;
10915 VecFile >> TempInt;
10916 LoadPrefDirElement.
ELinkPos = TempInt;
10917 VecFile >> TempInt;
10918 LoadPrefDirElement.
XLink = TempInt;
10919 VecFile >> TempInt;
10920 LoadPrefDirElement.
XLinkPos = TempInt;
10921 VecFile >> TempInt;
10922 LoadPrefDirElement.
EXNumber = TempInt;
10923 VecFile >> TempInt;
10928 if(!(LoadPrefDirElement.
IsARoute))
10956 int NumberOfPrefDirElements = 0;
10959 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
10964 for(
int x = 0; x < NumberOfPrefDirElements; x++)
10971 VecFile >> TempInt;
10972 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
10977 VecFile >> TempInt;
10978 if((TempInt < -1) || (TempInt > 9))
10983 VecFile >> TempInt;
10984 if((TempInt < -1) || (TempInt > 3))
10989 VecFile >> TempInt;
10990 if((TempInt < -1) || (TempInt > 9))
10995 VecFile >> TempInt;
10996 if((TempInt < -1) || (TempInt > 3))
11001 VecFile >> TempInt;
11002 if((TempInt < -1) || (TempInt > 27))
11007 VecFile >> TempInt;
11015 VecFile >> TempInt;
11016 if((TempInt != 0) && (TempInt != 1))
11021 VecFile >> TempInt;
11022 if((TempInt != 0) && (TempInt != 1))
11027 VecFile >> TempInt;
11028 if((TempInt != 0) && (TempInt != 1))
11051 for(
int y = 0; y < NumberOfPrefDirElements; y++)
11053 VecFile << y <<
'\n';
11054 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
11064 if(y == (NumberOfPrefDirElements - 1))
11066 VecFile <<
"************" <<
'\0' <<
'\n';
11070 VecFile <<
"******" <<
'\0' <<
'\n';
11084 for(
int y = 0; y < NumberOfSearchElements; y++)
11086 VecFile << y <<
'\n';
11087 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
11097 if(y == (NumberOfSearchElements - 1))
11099 VecFile <<
"************" <<
'\0' <<
'\n';
11103 VecFile <<
"******" <<
'\0' <<
'\n';
11208 bool AlreadyPresent, FoundFlag;
11209 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
11211 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
11215 AlreadyPresent =
false;
11219 AlreadyPresent =
true;
11221 AlreadyPresent =
true;
11223 AlreadyPresent =
true;
11225 AlreadyPresent =
true;
11227 if(!AlreadyPresent)
11272 for(
unsigned int z = 0; z < 4; z++)
11280 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
11294 bool DiscrepancyFound =
false;
11304 DiscrepancyFound =
true;
11307 DiscrepancyFound =
true;
11312 DiscrepancyFound =
true;
11317 DiscrepancyFound =
true;
11322 DiscrepancyFound =
true;
11327 DiscrepancyFound =
true;
11329 if(DiscrepancyFound)
11331 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
11346 bool DiscrepancyFound =
false;
11356 DiscrepancyFound =
true;
11359 DiscrepancyFound =
true;
11364 DiscrepancyFound =
true;
11369 DiscrepancyFound =
true;
11374 DiscrepancyFound =
true;
11379 DiscrepancyFound =
true;
11382 return !DiscrepancyFound;
11394 bool FoundFlag =
false;
11395 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
11403 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
11404 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
11406 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
11408 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
11409 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
11410 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
11415 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
11416 +
" Caller=" + (AnsiString)Caller);
11442 PrefDirMapKeyPair.first = HLoc;
11443 PrefDirMapKeyPair.second = VLoc;
11444 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
11447 if(ItPair.first == ItPair.second)
11455 PrefDirPos0 = ItPair.first->second;
11457 if(ItPair.first == ItPair.second)
11462 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
11463 PrefDirPos1 = ItPair.first->second;
11465 if(ItPair.first == ItPair.second)
11470 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
11471 PrefDirPos2 = ItPair.first->second;
11473 if(ItPair.first == ItPair.second)
11478 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
11479 PrefDirPos3 = ItPair.first->second;
11493 THVPair PrefDir4MultiMapKeyPair;
11496 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
11497 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
11498 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
11521 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
11540 AnsiString(ErasedElementNumber));
11545 if(MapPtr->second > ErasedElementNumber)
11565 throw Exception(
"PrefDirVectorPosition out of range");
11568 THVPair PrefDir4MultiMapKeyPair;
11570 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
11571 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
11572 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
11575 if(ItPair.first == ItPair.second)
11578 return ItPair.first;
11582 if(ItPair.first->second == PrefDirVectorPosition)
11586 return ItPair.first;
11589 if(ItPair.first == ItPair.second)
11592 return ItPair.first;
11594 if(ItPair.first->second == PrefDirVectorPosition)
11598 return ItPair.first;
11601 if(ItPair.first == ItPair.second)
11604 return ItPair.first;
11606 if(ItPair.first->second == PrefDirVectorPosition)
11610 return ItPair.first;
11613 if(ItPair.first == ItPair.second)
11616 return ItPair.first;
11618 if(ItPair.first->second == PrefDirVectorPosition)
11622 return ItPair.first;
11626 return ItPair.first;
11639 THVPair PrefDir4MultiMapKeyPair;
11641 PrefDir4MultiMapKeyPair.first = HLoc;
11642 PrefDir4MultiMapKeyPair.second = VLoc;
11643 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
11646 if(ItPair.first == ItPair.second)
11654 return ItPair.first->second;
11663 bool ErasedFlag =
false;
11665 if(ErasedTrackVectorPosition > -1)
11674 ErasedFlag =
false;
11676 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
11681 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
11686 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
11691 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
11696 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
11704 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
11708 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
11712 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
11716 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
11720 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
11735 OverallDistance = 0;
11736 OverallSpeedLimit = 0;
11737 LeadingPointsAtLastElement =
false;
11746 LeadingPointsAtLastElement =
true;
11755 OverallDistance += PrefDirElement.
Length23;
11756 if(OverallSpeedLimit != -1)
11766 OverallSpeedLimit = -1;
11773 OverallDistance += PrefDirElement.
Length01;
11774 if(OverallSpeedLimit != -1)
11784 OverallSpeedLimit = -1;
11804 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
11807 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
11811 HLoc = MMIT->first.first;
11812 VLoc = MMIT->first.second;
11817 if(PrefDirPos0 > -1)
11819 if(PrefDirPos1 > -1)
11821 if(PrefDirPos2 > -1)
11823 if(PrefDirPos3 > -1)
11825 if(PrefDirPos3 > -1)
11827 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
11829 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
11831 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
11833 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
11840 else if(PrefDirPos2 > -1)
11844 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
11846 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
11848 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
11856 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
11858 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
11860 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
11868 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
11870 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
11872 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
11879 else if(PrefDirPos1 > -1)
11883 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
11885 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
11892 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
11894 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
11900 else if(PrefDirPos0 > -1)
11902 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
11919 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
11922 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
11943 if(PrefDirPos0 > -1)
11945 if(PrefDirPos1 > -1)
11947 if(PrefDirPos2 > -1)
11949 if(PrefDirPos3 > -1)
11952 if(PrefDirPos3 > -1)
11957 else if(PrefDirPos2 > -1)
11959 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
11970 else if(PrefDirPos1 > -1)
11972 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
11983 else if(PrefDirPos0 > -1)
11985 if(PrefDirElement0.
XLinkPos == EntryPos)
12022 ElementIn.
VLoc +
"," + XLink);
12024 bool TrackFoundFlag;
12027 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
12040 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
12050 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
12065 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
12075 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
12090 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
12100 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
12115 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
12125 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
12148 bool FoundFlag, ContFlag, FoundElements =
false;
12149 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12154 LastIteratorValue++;
12175 if(PDVIt->XLinkPos == 0)
12180 StartElement = *PDVIt;
12189 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
12191 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
12192 if(PrefDirPos0 == -1)
12196 bool NextElementFoundFlag =
false;
12200 NextElementFoundFlag =
true;
12202 if(PrefDirPos1 > -1)
12207 NextElementFoundFlag =
true;
12210 if(PrefDirPos2 > -1)
12215 NextElementFoundFlag =
true;
12218 if(PrefDirPos3 > -1)
12223 NextElementFoundFlag =
true;
12226 if(!NextElementFoundFlag)
12256 EndElement = NextElement;
12260 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
12262 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
12263 if(PrefDirPos0 == -1)
12273 if(PrefDirPos1 > -1)
12281 if(PrefDirPos2 > -1)
12289 if(PrefDirPos3 > -1)
12318 FoundElements =
true;
12382 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
12384 int TrackVectorPosition;
12393 if(ConsecSignalsRoute)
12436 int LockedVectorNumber;
12460 bool InPrefDirFlag =
false;
12463 int PrefDirPos0 = -1;
12464 int PrefDirPos1 = -1;
12465 int PrefDirPos2 = -1;
12466 int PrefDirPos3 = -1;
12470 int PrefDirVecPos[4] =
12471 {PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3};
12473 for(
int x = 0; x < 4; x++)
12475 int b = PrefDirVecPos[x];
12478 if(ConsecSignalsRoute)
12487 InPrefDirFlag =
true;
12505 InPrefDirFlag =
true;
12511 InPrefDirFlag =
true;
12524 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
12533 if(DummyPair.first > -1)
12535 throw Exception(
"Selection in two routes - should never happen!");
12538 if(RoutePair.first > -1)
12568 if(ConsecSignalsRoute)
12618 IDInt &ReqPosRouteID,
bool &PointsChanged)
12658 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
12697 if(ConsecSignalsRoute)
12726 bool InPrefDirFlag =
false;
12729 int PrefDirPos0 = -1;
12730 int PrefDirPos1 = -1;
12731 int PrefDirPos2 = -1;
12732 int PrefDirPos3 = -1;
12735 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
12736 int PrefDirVecPos[4] =
12737 {PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3};
12739 for(
int x = 0; x < 4; x++)
12741 int b = PrefDirVecPos[x];
12744 InPrefDirFlag =
true;
12754 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
12764 if(RoutePair.first > -1)
12766 if(RoutePair.second != 0)
12783 EndElement1 = RouteElement;
12784 EndElement2 = BlankElement;
12889 PointsChanged =
true;
12914 PointsChanged =
true;
12935 PointsChanged =
true;
12963 PointsChanged =
true;
12977 PointsChanged =
true;
12993 PointsChanged =
true;
13004 PointsChanged =
true;
13020 PointsChanged =
true;
13072 TOnePrefDir *EveryPrefDir,
bool ConsecSignalsRoute,
int EndPosition,
bool AutoSigsFlag)
13125 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
13126 AnsiString((
short)AutoSigsFlag));
13127 int VectorCount = 0;
13131 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
13135 for(
int x = 0; x < VectorCount; x++)
13142 bool FirstPass =
true;
13152 for(
int x = 0; x < VectorCount; x++)
13159 for(
int x = 0; x < VectorCount; x++)
13164 if(!FirstPass && (ConsecSignalsRoute) && (PrefDirElement.
Config[PrefDirElement.
XLinkPos] ==
Signal))
13169 for(
int x = 0; x < VectorCount; x++)
13175 int NextPosition = PrefDirElement.
Conn[XLinkPos];
13179 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
13180 SearchElement.
ELinkPos = NextELinkPos;
13181 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
13194 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
13196 SearchElement.
XLinkPos = NextXLinkPos;
13208 for(
int x = 0; x < VectorCount; x++)
13220 if(RoutePair.first > -1)
13229 for(
int x = 0; x < VectorCount; x++)
13236 if(SecondPair.first > -1)
13245 for(
int x = 0; x < VectorCount; x++)
13258 for(
int x = 0; x < VectorCount; x++)
13267 for(
int x = 0; x < VectorCount; x++)
13274 for(
int x = 0; x < VectorCount; x++)
13282 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
13286 for(
int x = 0; x < VectorCount; x++)
13294 bool InPrefDirFlag =
false;
13295 PrefDirElement1 = BlankElement;
13296 PrefDirElement2 = BlankElement;
13299 int PrefDirPos0 = -1;
13300 int PrefDirPos1 = -1;
13301 int PrefDirPos2 = -1;
13302 int PrefDirPos3 = -1;
13305 int PrefDirVecPos[4] =
13306 {PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3};
13307 for(
int x = 0; x < 4; x++)
13309 int b = PrefDirVecPos[x];
13312 InPrefDirFlag =
true;
13321 for(
int x = 0; x < VectorCount; x++)
13332 for(
int x = 0; x < VectorCount; x++)
13345 for(
int x = 0; x < VectorCount; x++)
13354 if(ConsecSignalsRoute)
13365 for(
int x = 0; x < VectorCount; x++)
13379 for(
int x = 0; x < VectorCount; x++)
13387 for(
int x = 0; x < VectorCount; x++)
13396 int SearchPos1 = SearchElement.
Attribute + 1;
13398 if(SearchPos1 == 2)
13400 if(SearchPos1 == 1)
13404 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
13405 SearchElement.
XLinkPos = SearchPos1;
13406 InPrefDirFlag =
false;
13407 if(SearchElement.
XLink == PrefDirElement1.
XLink)
13409 SearchElement = PrefDirElement1;
13410 InPrefDirFlag =
true;
13412 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
13414 SearchElement = PrefDirElement2;
13415 InPrefDirFlag =
true;
13421 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
13425 for(
int x = 0; x < VectorCount; x++)
13435 if(ConsecSignalsRoute)
13453 for(
int x = 0; x < VectorCount; x++)
13469 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
13470 SearchElement.
XLinkPos = SearchPos2;
13471 if(SearchElement.
XLink == PrefDirElement1.
XLink)
13473 SearchElement = PrefDirElement1;
13475 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
13477 SearchElement = PrefDirElement2;
13481 for(
int x = 0; x < VectorCount; x++)
13487 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
13491 for(
int x = 0; x < VectorCount; x++)
13502 if(ConsecSignalsRoute)
13520 for(
int x = 0; x < VectorCount; x++)
13530 for(
int x = 0; x < VectorCount; x++)
13537 SearchElement = PrefDirElement1;
13542 if(ConsecSignalsRoute)
13549 XLinkPos = SearchElement.
XLinkPos;
13550 PrefDirElement = SearchElement;
13607 unsigned int TruncatePrefDirPosition = 0;
13681 throw Exception(
"Error - failed to validate extended route for preferred route");
13737 throw Exception(
"Error - failed to validate single route for preferred route");
13786 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
13788 int TrackVectorPosition;
13824 int LockedVectorNumber;
13855 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
13856 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
13859 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
13865 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
13866 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
13869 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
13883 if(RoutePair.first > -1)
14067 EndElement1.
ELink = EndElement1.
Link[0];
14068 EndElement1.
XLink = EndElement1.
Link[1];
14071 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
14076 EndElement2.
ELink = EndElement2.
Link[1];
14077 EndElement2.
XLink = EndElement2.
Link[0];
14080 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
14126 if(RoutePair.first > -1)
14128 if(RoutePair.second != 0)
14147 EndElement2 = BlankElement;
14226 PointsChanged =
true;
14250 PointsChanged =
true;
14270 PointsChanged =
true;
14294 PointsChanged =
true;
14308 PointsChanged =
true;
14346 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
14347 int VectorCount = 0;
14350 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
14351 (CurrentTrackElement.
Link[XLinkPos] == 9))
14355 for(
int x = 0; x < VectorCount; x++)
14366 for(
int x = 0; x < VectorCount; x++)
14371 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
14373 for(
int x = 0; x < VectorCount; x++)
14378 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
14382 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
14383 SearchElement.
ELinkPos = NextELinkPos;
14396 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
14398 SearchElement.
XLinkPos = NextXLinkPos;
14411 for(
int x = 0; x < VectorCount; x++)
14423 if(RoutePair.first > -1)
14432 for(
int x = 0; x < VectorCount; x++)
14439 if(SecondPair.first > -1)
14448 for(
int x = 0; x < VectorCount; x++)
14461 for(
int x = 0; x < VectorCount; x++)
14470 for(
int x = 0; x < VectorCount; x++)
14477 for(
int x = 0; x < VectorCount; x++)
14485 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14489 for(
int x = 0; x < VectorCount; x++)
14501 for(
int x = 0; x < VectorCount; x++)
14528 for(
int x = 0; x < VectorCount; x++)
14537 for(
int x = 0; x < VectorCount; x++)
14547 int SearchPos1 = SearchElement.
Attribute + 1;
14549 if(SearchPos1 == 2)
14551 if(SearchPos1 == 1)
14556 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
14557 SearchElement.
XLinkPos = SearchPos1;
14559 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14563 for(
int x = 0; x < VectorCount; x++)
14586 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
14587 SearchElement.
XLinkPos = SearchPos2;
14589 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14593 for(
int x = 0; x < VectorCount; x++)
14610 for(
int x = 0; x < VectorCount; x++)
14622 CurrentTrackElement = SearchElement;
14623 XLinkPos = SearchElement.
XLinkPos;
14645 throw Exception(
"Error, SearchVector empty");
14657 for(
int x = 0; x < 4; x++)
14691 throw Exception(
"Error in EntryExitNumber 3");
14747 unsigned int TruncatePrefDirPosition = 0;
14808 throw Exception(
"Failed to validate extended route for nonpreferred route");
14854 throw Exception(
"Failed to validate single route for nonpreferred route");
14874 if(!PrefDirVector.empty())
14878 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
14883 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
14918 if(!PrefDirVector.empty())
14921 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
14923 int ForwardLinkedRouteNumber, Attribute = 0;
14930 if(ForwardLinkedRouteNumber > -1)
14932 int NextForwardLinkedRouteNumber = -1;
14936 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
14946 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
14965 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
14973 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
15004 NextForwardLinkedRouteNumber = -1;
15005 for(
unsigned int x = 0; x < PrefDirSize(); x++)
15007 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
15008 if(PrefDirVector.at(x).TrackType ==
Bridge)
15010 if(PrefDirVector.at(x).XLinkPos < 2)
15011 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos01;
15013 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos23;
15020 if(PrefDirVector.at(x).TrackType ==
Buffers)
15032 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
15041 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
15043 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute + 1;
15049 if(x == PrefDirSize() - 1)
15091 AnsiString(PrefDirVectorStartPosition));
15096 bool SkipContinuationAndBufferAttributeChange =
false;
15098 if(!PrefDirVector.empty())
15100 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
15103 if(PrefDirPtr->TrackType ==
Bridge)
15105 if(PrefDirPtr->XLinkPos < 2)
15112 SkipContinuationAndBufferAttributeChange =
true;
15127 SkipContinuationAndBufferAttributeChange =
true;
15135 SkipContinuationAndBufferAttributeChange =
true;
15137 if(!SkipContinuationAndBufferAttributeChange)
15139 if(PrefDirVector.back().TrackType ==
Buffers)
15145 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
15148 if(PrefDirPtr->TrackType ==
Bridge)
15150 if(PrefDirPtr->XLinkPos < 2)
15162 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
15171 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
15173 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
15174 PrefDirPtr->ConsecSignals)
15215 "," + AnsiString((
short)ConsecSignalsRoute));
15216 bool ElementInRoute =
false;
15217 bool TrainOccupyingRoute =
false;
15223 ElementInRoute =
true;
15227 if(!ElementInRoute)
15251 TrainOccupyingRoute =
true;
15319 if(LRVIT->RouteNumber == RouteNumber)
15334 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
15335 L
"Warning!", MB_YESNO | MB_ICONWARNING);
15347 bool ExistingLockedRouteModified =
false;
15360 if(LRVIT->RouteNumber == RouteNumber)
15364 ExistingLockedRouteModified =
true;
15368 if(!ExistingLockedRouteModified)
15456 AnsiString((
short)ConsecSignalsRoute));
15466 ConsecSignalsRoute);
15481 AnsiString((
short)ConsecSignalsRoute));
15491 RouteFlashElement.
HLoc = H;
15492 RouteFlashElement.
VLoc = V;
15508 int H = PrefDirPtr->HLoc;
15509 int V = PrefDirPtr->VLoc;
15571 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
15575 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
15578 OverlayPlotted =
false;
15588 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
15590 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
15593 return AllRoutesVector.at(At);
15602 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
15604 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
15607 return AllRoutesVector.at(At);
15618 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
15620 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
15630 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
15632 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
15650 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignalsRoute));
15651 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
15654 RouteTruncateFlag =
true;
15656 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, ConsecSignalsRoute, ReturnFlag);
15657 RouteTruncateFlag =
false;
15684 AnsiString(LinkPos));
15685 if(TrackVectorPosition == -1)
15690 THVPair Route2MultiMapKeyPair;
15694 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
15697 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
15707 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
15709 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
15712 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
15713 Route2MultiMapIterator->second.second);
15714 EntryLinkPos = PrefDirElement1.
ELinkPos;
15715 ExitLinkPos = PrefDirElement1.
XLinkPos;
15716 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
15717 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
15729 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
15741 Graphics::TBitmap* &EntryDirectionGraphicPtr)
15751 AnsiString(LinkPos));
15754 if(TrackVectorPosition == -1)
15759 THVPair Route2MultiMapKeyPair;
15763 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
15766 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
15771 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
15773 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
15775 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
15776 Route2MultiMapIterator->second.second);
15777 EntryLinkPos = PrefDirElement1.
ELinkPos;
15778 ExitLinkPos = PrefDirElement1.
XLinkPos;
15779 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
15780 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
15784 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
15785 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
15792 return AutoSigsRoute;
15797 return NotAutoSigsRoute;
15803 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
15804 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
15811 return AutoSigsRoute;
15816 return NotAutoSigsRoute;
15820 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
15822 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
15823 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
15825 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
15826 EntryLinkPos = PrefDirElement2.
ELinkPos;
15827 ExitLinkPos = PrefDirElement2.
XLinkPos;
15828 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
15829 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
15833 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
15840 return AutoSigsRoute;
15845 return NotAutoSigsRoute;
15851 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
15858 return AutoSigsRoute;
15863 return NotAutoSigsRoute;
15868 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
15869 EntryLinkPos = PrefDirElement3.
ELinkPos;
15870 ExitLinkPos = PrefDirElement3.
XLinkPos;
15871 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
15872 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
15876 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
15883 return AutoSigsRoute;
15888 return NotAutoSigsRoute;
15894 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
15901 return AutoSigsRoute;
15906 return NotAutoSigsRoute;
15922 AnsiString(LinkPos));
15923 if(TrackVectorPosition == -1)
15929 THVPair Route2MultiMapKeyPair;
15933 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
15936 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
15942 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
15944 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
15946 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
15947 Route2MultiMapIterator->second.second);
15948 EntryLinkPos = PrefDirElement1.
ELinkPos;
15949 ExitLinkPos = PrefDirElement1.
XLinkPos;
15950 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
15951 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
15954 RouteNumber = Route2MultiMapIterator->second.first;
15958 return AutoSigsRoute;
15963 return NotAutoSigsRoute;
15968 RouteNumber = Route2MultiMapIterator->second.first;
15972 return AutoSigsRoute;
15977 return NotAutoSigsRoute;
15981 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
15983 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
15984 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
15986 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
15987 EntryLinkPos = PrefDirElement2.
ELinkPos;
15988 ExitLinkPos = PrefDirElement2.
XLinkPos;
15989 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
15990 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
15993 RouteNumber = ItPair.first->second.first;
15997 return AutoSigsRoute;
16002 return NotAutoSigsRoute;
16007 RouteNumber = ItPair.first->second.first;
16011 return AutoSigsRoute;
16016 return NotAutoSigsRoute;
16021 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
16022 EntryLinkPos = PrefDirElement3.
ELinkPos;
16023 ExitLinkPos = PrefDirElement3.
XLinkPos;
16024 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
16025 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
16028 RouteNumber = ItPair.second->second.first;
16032 return AutoSigsRoute;
16037 return NotAutoSigsRoute;
16042 RouteNumber = ItPair.second->second.first;
16046 return AutoSigsRoute;
16051 return NotAutoSigsRoute;
16073 EmptyRoute.
RouteID = NextRouteID;
16076 AllRoutesVector.push_back(EmptyRoute);
16077 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
16102 AllRoutesVector.push_back(EmptyRoute);
16103 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
16126 THVPair Route2MultiMapKeyPair;
16135 LockedRouteTruncateTrackVectorPosition = 0;
16136 LockedRouteLastTrackVectorPosition = 0;
16137 LockedRouteLastXLinkPos = 0;
16138 LockedRouteLockStartTime = TDateTime(0);
16139 if(!LockedRouteVector.empty())
16143 if(LRVIT->RouteNumber == RouteNumber)
16145 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
16146 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
16147 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
16148 LockedRouteLockStartTime = LRVIT->LockStartTime;
16149 LockedRouteFoundDuringRouteBuilding =
true;
16150 LockedRouteVector.erase(LRVIT);
16176 AnsiString(VLoc) +
"," + AnsiString(ELink));
16179 ReturnPair.first = -1;
16180 ReturnPair.second = 0;
16181 THVPair Route2MultiMapKeyPair;
16183 Route2MultiMapKeyPair.first = HLoc;
16184 Route2MultiMapKeyPair.second = VLoc;
16187 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
16188 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
16190 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
16191 Route2MultiMapIterator = ItPair.first;
16193 if(ItPair.first == ItPair.second)
16195 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
16198 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
16200 ReturnPair.first = ItPair.first->second.first;
16201 ReturnPair.second = ItPair.first->second.second;
16202 Route2MultiMapIterator = ItPair.first;
16207 if(ItPair.first == ItPair.second)
16209 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
16211 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
16213 ReturnPair.first = ItPair.first->second.first;
16214 ReturnPair.second = ItPair.first->second.second;
16215 Route2MultiMapIterator = ItPair.first;
16235 AnsiString(VLoc) +
"," + AnsiString(ELink));
16236 THVPair Route2MultiMapKeyPair;
16238 Route2MultiMapKeyPair.first = HLoc;
16239 Route2MultiMapKeyPair.second = VLoc;
16240 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
16242 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
16244 if(ItPair.first == ItPair.second)
16251 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
16253 RouteNumber = ItPair.first->second.first;
16260 if(ItPair.first == ItPair.second)
16267 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
16269 RouteNumber = ItPair.first->second.first;
16290 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
16291 THVPair Route2MultiMapKeyPair;
16293 Route2MultiMapKeyPair.first = HLoc;
16294 Route2MultiMapKeyPair.second = VLoc;
16297 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
16300 RouteElementPair.first = RouteNumber;
16301 RouteElementPair.second = RouteElementNumber;
16302 Route2MultiMapEntry.second = RouteElementPair;
16304 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
16307 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
16308 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
16311 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
16312 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
16314 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
16316 Route2MultiMap.insert(Route2MultiMapEntry);
16321 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
16325 Route2MultiMap.insert(Route2MultiMapEntry);
16342 TempPair.first = -1;
16343 TempPair.second = 0;
16344 SecondPair = TempPair;
16346 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
16347 THVPair Route2MultiMapKeyPair;
16349 Route2MultiMapKeyPair.first = HLoc;
16350 Route2MultiMapKeyPair.second = VLoc;
16351 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
16356 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
16358 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
16360 return Route2MultiMapIterator->second;
16362 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
16364 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
16365 TempPair = ItRange.first->second;
16366 SecondPair = (--ItRange.second)->second;
16389 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
16390 if(RouteElementPair.first == -1)
16393 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
16394 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
16396 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
16399 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
16400 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
16401 (AnsiString)Caller);
16403 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
16406 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
16407 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
16408 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
16409 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
16413 unsigned int SizeVal = 0;
16416 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
16418 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
16420 if(SizeVal != Route2MultiMap.size())
16422 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
16423 (AnsiString)Caller);
16439 if(!Route2MultiMap.empty())
16441 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
16443 if(Route2MultiMapIterator->second.first > RouteNumber)
16444 Route2MultiMapIterator->second.first--;
16460 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
16461 if(!Route2MultiMap.empty())
16463 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
16465 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
16466 Route2MultiMapIterator->second.second--;
16484 AnsiString(ELink));
16488 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
16489 if(RequiredRoutePair.first == -1)
16491 throw Exception(
"Failed to find route element in RemoveRouteElement");
16493 Route2MultiMap.erase(Route2MultiMapIterator);
16494 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
16497 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
16519 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
16520 RequiredRoutePair.second)));
16531 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
16540 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
16542 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
16543 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
16544 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
16556 if(!LockedRouteVector.empty())
16560 if(LRVIT->RouteNumber > RequiredRoutePair.first)
16562 LRVIT->RouteNumber--;
16573 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
16574 AutoSigVectorIT->RouteNumber--;
16578 CheckMapAndRoutes(7);
16592 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
16593 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
16594 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
16610 "," + AnsiString(XLinkPos));
16614 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
16615 if(RouteElementPair.first == -1)
16617 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
16619 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
16621 RequiredPair = RouteElementPair;
16622 if(RouteElement.
XLinkPos != XLinkPos)
16624 if(SecondPair.first != -1)
16626 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
16627 RequiredPair = SecondPair;
16628 if(RouteElement.
XLinkPos != XLinkPos)
16630 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
16635 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
16640 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
16660 AnsiString(AccessNumber));
16662 int Attribute = AccessNumber + 1;
16664 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
16668 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
16672 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
16675 x).XLinkPos] !=
End)
16677 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
16680 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
16722 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
16723 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
16724 int RearwardLinkedRouteNumber;
16748 int TrainID, TrainPosition, BehindTrainPosition;
16749 bool FoundTrain =
false, BehindTrain =
false;
16750 for(
int x = RouteStartPosition; x >= 0; x--)
16752 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
16771 if(FoundTrain && (TrainPosition > 1))
16773 for(
int x = TrainPosition; x >= 0; x--)
16778 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
16792 BehindTrain =
true;
16793 BehindTrainPosition = x;
16800 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
16817 AnsiString(RouteTruncatePosition));
16818 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
16819 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
16822 bool ExamineRoute =
true;
16824 while(ExamineRoute)
16826 for(
int x = StartPosition; x >= 0; x--)
16863 if(SignalCount >= 3)
16882 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
16883 ExamineRoute =
true;
16884 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
16915 ExamineRoute =
false;
16930 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
16933 PrefDirElement = InternalPrefDirElement;
16934 if(LockedRouteVector.empty())
16941 bool InLockedRoute =
false;
16945 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
16948 InLockedRoute =
true;
16958 int RouteNumber, VectorCount = 0;
16963 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
16964 if(RouteType == NoRoute)
16968 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
16971 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
16973 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
16975 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
16976 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
16980 PrefDirElement = InternalPrefDirElement;
16981 LockedVectorNumber = VectorCount;
16986 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
16990 PrefDirElement = InternalPrefDirElement;
16991 LockedVectorNumber = VectorCount;
17010 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
17012 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
17018 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
17028 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
17030 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
17045 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
17047 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
17050 return GetFixedRouteAt(159, x);
17053 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
17061 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
17063 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
17066 return GetModifiableRouteAt(15, x);
17069 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
17079 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
17081 TOneRoute OneRoute = GetFixedRouteAt(165, x);
17093 int NumberOfRoutes;
17097 for(
int x = 0; x < NumberOfRoutes; x++)
17104 StoreOneRouteAfterSessionLoad(0, &OneRoute);
17122 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
17129 if((NextID < 0) || (NextID > 1000000))
17134 for(
int x = 0; x < NumberOfRoutes; x++)
17158 AnsiString(StartPosition));
17159 if(EndPosition == StartPosition)
17165 int TVPos = EndPosition;
17166 int LkPos = EndXLinkPos;
17168 while(TrackIsInARoute(15, TVPos, LkPos))
17189 if((NewLkPos == 0) || (NewLkPos == 2))
17201 if(TVPos == StartPosition)
17233 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
17238 if(FirstPair.first > -1)
17241 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17246 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17252 if(SecondPair.first > -1)
17255 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17260 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17267 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
17275 if(FirstPair.first > -1)
17278 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17283 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17289 if(SecondPair.first > -1)
17292 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17297 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17304 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
17312 if(FirstPair.first > -1)
17315 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17320 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17326 if(SecondPair.first > -1)
17329 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17334 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17341 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
17349 if(FirstPair.first > -1)
17352 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17357 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17363 if(SecondPair.first > -1)
17366 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17371 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17378 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
17403 "," + AnsiString(DiagonalLinkNumber));
17408 if(FirstPair.first > -1)
17411 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17416 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17422 if(SecondPair.first > -1)
17425 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17430 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17438 if(FirstPair.first > -1)
17441 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17446 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17452 if(SecondPair.first > -1)
17455 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17460 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
17468 if(FirstPair.first > -1)
17471 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17476 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17482 if(SecondPair.first > -1)
17485 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17490 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
17498 if(FirstPair.first > -1)
17501 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17506 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
17512 if(SecondPair.first > -1)
17515 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
17520 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))